<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <div>App 父组件</div>
    <hr>
    <son class="box" style="width: 300px; height: 200px; background: #ccc;" @click="handleClick"></son>
  </div>

  <script src="./lib/vue.global.js"></script>
  <script>
    const app = Vue.createApp({
      methods: {
        handleClick() {
          console.log('点击了子组件')
        },
      }
    })

    app.component('son', {
      inheritAttrs: false,
      template: `
        <div class="container" style="background: #f00;" @click="handleSonClick">这是子组件</div>
      `,
      methods: {
        handleSonClick() {
          console.log('这是子组件的 son click 事件...')
        },
      },
    })

    app.mount('#app')
  </script>
</body>
</html>